/*    1:     */ package gov.sat.tax.fwsk.wlrz;
/*    2:     */ 
/*    3:     */ import com.htxx.security.cipher.CommonBean;
/*    4:     */ import gov.sat.tax.fwsk.util.IDEA4Java;
/*    5:     */ import gov.sat.tax.fwsk.ycl.TransJmdataPort;
/*    6:     */ import java.io.BufferedReader;
/*    7:     */ import java.io.DataInputStream;
/*    8:     */ import java.io.DataOutputStream;
/*    9:     */ import java.io.IOException;
/*   10:     */ import java.io.InputStreamReader;
/*   11:     */ import java.io.PrintStream;
/*   12:     */ import java.net.ConnectException;
/*   13:     */ import java.net.MalformedURLException;
/*   14:     */ import java.net.Socket;
/*   15:     */ import java.net.URL;
/*   16:     */ import java.net.URLConnection;
/*   17:     */ import java.security.MessageDigest;
/*   18:     */ import java.security.NoSuchAlgorithmException;
/*   19:     */ import java.util.ArrayList;
/*   20:     */ import java.util.List;
/*   21:     */ import java.util.StringTokenizer;
/*   22:     */ 
/*   23:     */ public class JmHandler
/*   24:     */ {
/*   25:  36 */   private JmFpDataBean curJmData = null;
/*   26:     */   private int status;
/*   27:     */   
/*   28:     */   public JmHandler()
/*   29:     */   {
/*   30:  44 */     this.status = 0;
/*   31:  45 */     this.curJmData = new JmFpDataBean();
/*   32:     */   }
/*   33:     */   
/*   34:     */   public void doJmProc_Jms(String fpmw, String jmip, boolean hzfw)
/*   35:     */   {
/*   36:  49 */     byte[] d = (byte[])null;
/*   37:  50 */     if (fpmw.length() > 84)
/*   38:     */     {
/*   39:  51 */       d = a2bcd(fpmw); byte[] 
/*   40:  52 */         tmp25_21 = d;tmp25_21[52] = ((byte)(tmp25_21[52] ^ d[23]));
/*   41:     */     }
/*   42:  60 */     doJmProc_Jms_Hx2(fpmw, jmip, hzfw);
/*   43:     */   }
/*   44:     */   
/*   45:     */   private void doJmProc_Jms_AI3(String fpmw, String jmip, boolean hzfw)
/*   46:     */   {
/*   47:  66 */     String[] renVal = { "", "", "", "", "", "", "", "", "", "", "" };
/*   48:  67 */     DataInputStream in = null;
/*   49:  68 */     DataOutputStream out = null;
/*   50:  69 */     byte[] indata = new byte[2048];
/*   51:  70 */     byte[] outdata = new byte[123];
/*   52:  71 */     byte[] mw = (byte[])null;
/*   53:     */     
/*   54:     */ 
/*   55:  74 */     StringTokenizer lineunit = null;
/*   56:  75 */     Socket socket = null;
/*   57:  76 */     long ulms = System.currentTimeMillis();
/*   58:     */     
/*   59:  78 */     String chineseAnswer = "";
/*   60:  79 */     List wpmxLst = new ArrayList();
/*   61:  81 */     if (jmip == null)
/*   62:     */     {
/*   63:  82 */       this.status = 530;
/*   64:  83 */       System.out.println("没有可用的解密服务器 !");
/*   65:  84 */       return;
/*   66:     */     }
/*   67:  87 */     String errno = null;
/*   68:  88 */     String fpmwExt = "";
/*   69:  89 */     if (hzfw)
/*   70:     */     {
/*   71:  90 */       fpmwExt = fpmw.substring(108);
/*   72:  91 */       fpmw = fpmw.substring(0, 108);
/*   73:     */     }
/*   74:     */     try
/*   75:     */     {
/*   76:  95 */       if (!fpCheck(fpmw))
/*   77:     */       {
/*   78:  96 */         this.curJmData.setErrNo(-1);
/*   79:  97 */         return;
/*   80:     */       }
/*   81: 100 */       socket = new Socket(jmip, 9999);
/*   82:     */       
/*   83: 102 */       socket.setSoTimeout(5000);
/*   84: 103 */       in = new DataInputStream(socket.getInputStream());
/*   85: 104 */       out = new DataOutputStream(socket.getOutputStream());
/*   86: 108 */       for (int i = 0; i < 10; i++) {
/*   87: 109 */         outdata[i] = 0;
/*   88:     */       }
/*   89: 111 */       outdata[11] = 0;
/*   90:     */       
/*   91: 113 */       outdata[12] = 0;
/*   92: 114 */       if (fpmw.length() <= 84)
/*   93:     */       {
/*   94: 115 */         outdata[13] = 1;
/*   95: 116 */         outdata[10] = 86;
/*   96:     */       }
/*   97:     */       else
/*   98:     */       {
/*   99: 118 */         outdata[13] = 3;
/*  100: 119 */         outdata[10] = 110;
/*  101:     */       }
/*  102: 122 */       mw = fpmw.getBytes();
/*  103: 123 */       if (outdata[13] == 1) {
/*  104: 124 */         for (i = 0; i < 84; i++) {
/*  105: 125 */           outdata[(14 + i)] = mw[i];
/*  106:     */         }
/*  107:     */       }
/*  108: 127 */       if (outdata[13] == 3) {
/*  109: 128 */         for (i = 0; i < 108; i++) {
/*  110: 129 */           outdata[(14 + i)] = mw[i];
/*  111:     */         }
/*  112:     */       }
/*  113: 132 */       if (hzfw)
/*  114:     */       {
/*  115: 133 */         outdata[13] = 4;
/*  116: 134 */         for (i = 0; i < 108; i++) {
/*  117: 135 */           outdata[(14 + i)] = mw[i];
/*  118:     */         }
/*  119:     */       }
/*  120: 138 */       if (outdata[13] == 1)
/*  121:     */       {
/*  122: 140 */         outdata[98] = 0;
/*  123: 141 */         for (i = 0; i < 88; i++)
/*  124:     */         {
/*  125: 142 */           byte[] tmp515_511 = outdata;tmp515_511[98] = ((byte)(tmp515_511[98] + outdata[(10 + i)]));
/*  126:     */         }
/*  127:     */       }
/*  128: 144 */       if (outdata[13] == 3)
/*  129:     */       {
/*  130: 146 */         outdata[122] = 0;
/*  131: 147 */         for (i = 0; i < 112; i++)
/*  132:     */         {
/*  133: 148 */           byte[] tmp563_559 = outdata;tmp563_559[122] = ((byte)(tmp563_559[122] + outdata[(10 + i)]));
/*  134:     */         }
/*  135:     */       }
/*  136: 150 */       if (outdata[13] == 4)
/*  137:     */       {
/*  138: 152 */         outdata[122] = 0;
/*  139: 153 */         for (i = 0; i < 112; i++)
/*  140:     */         {
/*  141: 154 */           byte[] tmp611_607 = outdata;tmp611_607[122] = ((byte)(tmp611_607[122] + outdata[(10 + i)]));
/*  142:     */         }
/*  143:     */       }
/*  144: 159 */       out.write(outdata);
/*  145: 160 */       out.flush();
/*  146:     */       
/*  147: 162 */       in.read(indata);
/*  148:     */       
/*  149:     */ 
/*  150: 165 */       in.close();
/*  151: 166 */       out.close();
/*  152: 167 */       socket.close();
/*  153: 168 */       socket = null;
/*  154: 171 */       if (indata[3] == 0)
/*  155:     */       {
/*  156: 173 */         String tmp = new String(indata, 4, 2044);
/*  157: 174 */         lineunit = new StringTokenizer(tmp);
/*  158:     */       }
/*  159:     */       else
/*  160:     */       {
/*  161: 177 */         this.curJmData.setErrNo(-1); return;
/*  162:     */       }
/*  163:     */       String tmp;
/*  164:     */       int i;
/*  165: 181 */       if (hzfw) {
/*  166: 182 */         for (i = 0; i < 11; i++)
/*  167:     */         {
/*  168: 183 */           renVal[i] = lineunit.nextToken().trim();
/*  169: 184 */           if (i == 0)
/*  170:     */           {
/*  171: 185 */             errno = renVal[0];
/*  172: 186 */             if ((!errno.equals("0")) && (errno.compareTo("1000") < 0)) {
/*  173:     */               break;
/*  174:     */             }
/*  175:     */           }
/*  176:     */         }
/*  177:     */       } else {
/*  178: 192 */         for (i = 0; i < 9; i++)
/*  179:     */         {
/*  180: 193 */           renVal[i] = lineunit.nextToken().trim();
/*  181: 194 */           if (i == 0)
/*  182:     */           {
/*  183: 195 */             errno = renVal[0];
/*  184: 196 */             if ((!errno.equals("0")) && (errno.compareTo("1000") < 0)) {
/*  185:     */               break;
/*  186:     */             }
/*  187:     */           }
/*  188:     */         }
/*  189:     */       }
/*  190: 205 */       if (errno == null)
/*  191:     */       {
/*  192: 206 */         this.curJmData.setErrNo(-1); return;
/*  193:     */       }
/*  194:     */       String tmp;
/*  195:     */       int i;
/*  196: 209 */       if (errno.length() == 0)
/*  197:     */       {
/*  198: 210 */         this.curJmData.setErrNo(-1); return;
/*  199:     */       }
/*  200:     */       String tmp;
/*  201:     */       int i;
/*  202: 214 */       int i_errno = Integer.parseInt(errno);
/*  203: 216 */       if ((i_errno == 0) || (i_errno >= 1000))
/*  204:     */       {
/*  205: 217 */         this.curJmData.setErrNo(i_errno);
/*  206: 218 */         this.curJmData.setFp_dm(renVal[1]);
/*  207: 219 */         this.curJmData.setFp_hm(renVal[2]);
/*  208: 220 */         this.curJmData.setGf_nsrsbh(renVal[4]);
/*  209: 221 */         this.curJmData.setXf_nsrsbh(renVal[5]);
/*  210: 222 */         this.curJmData.setFp_je(Double.parseDouble(renVal[6]));
/*  211: 223 */         this.curJmData.setFp_se(Double.parseDouble(renVal[7]));
/*  212: 224 */         this.curJmData.setKprq(renVal[3]);
/*  213: 225 */         if (renVal[8].indexOf("%") >= 0) {
/*  214: 226 */           renVal[8] = renVal[8].substring(0, renVal[8].length() - 1);
/*  215:     */         }
/*  216: 228 */         this.curJmData.setFp_sl(renVal[8]);
/*  217: 230 */         if (hzfw)
/*  218:     */         {
/*  219: 238 */           chineseAnswer = fpmwExt;
/*  220:     */           
/*  221: 240 */           byte[] key = CommonBean.hex2byte(renVal[9]);
/*  222: 241 */           byte[] data = CommonBean.hex2byte(chineseAnswer.substring(0, 672));
/*  223:     */           
/*  224:     */ 
/*  225:     */ 
/*  226:     */ 
/*  227: 246 */           IDEA4Java idea = new IDEA4Java();
/*  228:     */           
/*  229:     */ 
/*  230: 249 */           byte[] chinese1 = idea.IdeaEncrypt(key, data, false);
/*  231: 250 */           chinese1 = reverseByte(chinese1);
/*  232: 251 */           byte[] chinese = new byte[336];
/*  233: 252 */           System.arraycopy(chinese1, 0, chinese, 0, 336);
/*  234:     */           
/*  235:     */ 
/*  236:     */ 
/*  237: 256 */           byte[] crc_s1 = CommonBean.hex2byte(renVal[10].substring(0, 
/*  238: 257 */             48));
/*  239: 258 */           MessageDigest md5 = MessageDigest.getInstance("MD5");
/*  240: 259 */           md5.update(chinese);
/*  241: 260 */           byte[] crc_s2 = md5.digest();
/*  242: 261 */           byte[] crc_source = new byte[crc_s1.length + crc_s2.length];
/*  243: 262 */           System.arraycopy(crc_s1, 0, crc_source, 0, crc_s1.length);
/*  244: 263 */           System.arraycopy(crc_s2, 0, crc_source, crc_s1.length, 
/*  245: 264 */             crc_s2.length);
/*  246: 265 */           md5.update(crc_source);
/*  247: 266 */           byte[] crc = md5.digest();
/*  248: 267 */           byte[] crc_target = CommonBean.hex2byte(renVal[10]
/*  249: 268 */             .substring(48));
/*  250: 270 */           if ((crc[0] != crc_target[0]) || (crc[1] != crc_target[1]) || 
/*  251: 271 */             (crc[2] != crc_target[2]) || 
/*  252: 272 */             (crc[3] != crc_target[3])) {
/*  253: 273 */             System.out.println("汉字信息CRC校验错误！");
/*  254:     */           } else {
/*  255: 276 */             wpmxLst = getHzInfoList(chinese);
/*  256:     */           }
/*  257:     */         }
/*  258: 279 */         this.curJmData.setHzInfoList(wpmxLst);
/*  259:     */       }
/*  260: 280 */       else if (i_errno == 400)
/*  261:     */       {
/*  262: 281 */         this.curJmData.setErrNo(i_errno);
/*  263:     */       }
/*  264: 282 */       else if (i_errno == 403)
/*  265:     */       {
/*  266: 283 */         this.curJmData.setErrNo(i_errno);
/*  267:     */       }
/*  268: 284 */       else if ((i_errno >= 1) && (i_errno <= 255) && 
/*  269: 285 */         (i_errno >= 1) && (i_errno <= 255))
/*  270:     */       {
/*  271: 286 */         this.curJmData.setErrNo(i_errno);
/*  272:     */       }
/*  273:     */     }
/*  274:     */     catch (MalformedURLException e)
/*  275:     */     {
/*  276: 289 */       this.status = 540;
/*  277: 290 */       System.out.println(e.getMessage());
/*  278:     */     }
/*  279:     */     catch (IOException e)
/*  280:     */     {
/*  281: 292 */       this.status = 550;
/*  282: 293 */       System.out.println(e.getMessage());
/*  283:     */     }
/*  284:     */     catch (NoSuchAlgorithmException e)
/*  285:     */     {
/*  286: 295 */       e.printStackTrace();
/*  287:     */     }
/*  288:     */     catch (Exception e)
/*  289:     */     {
/*  290: 297 */       e.printStackTrace();
/*  291:     */     }
/*  292:     */     finally
/*  293:     */     {
/*  294:     */       try
/*  295:     */       {
/*  296: 300 */         if (socket != null) {
/*  297: 301 */           socket.close();
/*  298:     */         }
/*  299: 302 */         in.close();
/*  300: 303 */         in = null;
/*  301:     */       }
/*  302:     */       catch (Exception localException9) {}
/*  303: 307 */       ulms = System.currentTimeMillis() - ulms;
/*  304: 308 */       System.out.println("[INFO] 解密完成: " + jmip + " (" + ulms + "ms)");
/*  305:     */     }
/*  306:     */   }
/*  307:     */   
/*  308:     */   private void doJmProc_Jms_Hx2(String fpmw, String jmip, boolean hzfw)
/*  309:     */   {
/*  310: 312 */     List zhLst = new ArrayList();
/*  311:     */     
/*  312:     */ 
/*  313:     */ 
/*  314: 316 */     String[] renVal = { "", "", "", "", "", "", "", "", "", "", "" };
/*  315:     */     
/*  316: 318 */     byte[] fpmwPre = new byte[100];
/*  317: 319 */     byte[] marker = new byte[1];
/*  318:     */     
/*  319:     */ 
/*  320: 322 */     DataInputStream in = null;
/*  321: 323 */     DataOutputStream out = null;
/*  322: 324 */     byte[] indata = new byte[100];
/*  323: 325 */     byte[] outdata = new byte[97];
/*  324:     */     
/*  325:     */ 
/*  326: 328 */     byte[] mw = (byte[])null;
/*  327:     */     
/*  328:     */ 
/*  329: 331 */     StringTokenizer lineunit = null;
/*  330:     */     
/*  331: 333 */     Socket socket = null;
/*  332: 334 */     long ulms = System.currentTimeMillis();
/*  333:     */     
/*  334: 336 */     String chineseAnswer = "";
/*  335: 337 */     List wpmxLst = new ArrayList();
/*  336:     */     
/*  337: 339 */     int ierror = 0;
/*  338: 340 */     String fpmwExt = "";
/*  339: 341 */     if (hzfw)
/*  340:     */     {
/*  341: 342 */       fpmwExt = fpmw.substring(108);
/*  342: 343 */       fpmw = fpmw.substring(0, 108);
/*  343:     */     }
/*  344: 346 */     if (!fpCheck(fpmw))
/*  345:     */     {
/*  346: 347 */       this.curJmData.setErrNo(-1);
/*  347: 348 */       return;
/*  348:     */     }
/*  349: 351 */     TransJmdataPort tPort = new TransJmdataPort();
/*  350: 352 */     if (fpmw.length() <= 84)
/*  351:     */     {
/*  352: 354 */       fpmwPre = tPort.VJMJRZDATAIN(fpmw, 1, fpmwPre, marker);
/*  353:     */     }
/*  354: 356 */     else if (hzfw)
/*  355:     */     {
/*  356: 358 */       fpmwPre = tPort.VJMJRZDATAIN(fpmw, 3, fpmwPre, marker);
/*  357:     */     }
/*  358:     */     else
/*  359:     */     {
/*  360: 360 */       System.out.println("---------------------------------执行到调用dll ");
/*  361: 361 */       fpmwPre = tPort.VJMJRZDATAIN(fpmw, 2, fpmwPre, marker);
/*  362:     */     }
/*  363: 365 */     byte outtype = fpmwPre[82];
/*  364: 366 */     ierror = fpmwPre[83];
/*  365: 372 */     if (ierror != 0)
/*  366:     */     {
/*  367: 373 */       this.curJmData.setErrNo(-1);
/*  368: 374 */       return;
/*  369:     */     }
/*  370: 382 */     if (jmip == null)
/*  371:     */     {
/*  372: 383 */       this.status = 530;
/*  373: 384 */       System.out.println("没有可用的解密服务器 !！！");
/*  374: 385 */       return;
/*  375:     */     }
/*  376: 388 */     String errno = null;
/*  377:     */     try
/*  378:     */     {
/*  379: 391 */       socket = new Socket(jmip, 9999);
/*  380: 392 */       socket.setSoTimeout(5000);
/*  381: 393 */       in = new DataInputStream(socket.getInputStream());
/*  382: 394 */       out = new DataOutputStream(socket.getOutputStream());
/*  383: 398 */       for (int i = 0; i < 10; i++) {
/*  384: 399 */         outdata[i] = 0;
/*  385:     */       }
/*  386: 401 */       outdata[10] = 84;
/*  387: 402 */       outdata[11] = 0;
/*  388:     */       
/*  389: 404 */       outdata[12] = 0;
/*  390:     */       
/*  391: 406 */       outdata[13] = outtype;
/*  392:     */       
/*  393:     */ 
/*  394: 409 */       mw = fpmwPre;
/*  395: 412 */       for (i = 0; i < 82; i++) {
/*  396: 413 */         outdata[(14 + i)] = mw[i];
/*  397:     */       }
/*  398: 415 */       outdata[96] = 0;
/*  399: 416 */       for (i = 0; i < 86; i++)
/*  400:     */       {
/*  401: 417 */         byte[] tmp453_449 = outdata;tmp453_449[96] = ((byte)(tmp453_449[96] + outdata[(10 + i)]));
/*  402:     */       }
/*  403: 425 */       out.write(outdata);
/*  404: 426 */       out.flush();
/*  405:     */       
/*  406: 428 */       in.read(indata);
/*  407:     */       
/*  408:     */ 
/*  409: 431 */       in.close();
/*  410: 432 */       out.close();
/*  411: 433 */       socket.close();
/*  412: 434 */       socket = null;
/*  413: 436 */       if (indata[3] == 0)
/*  414:     */       {
/*  415: 443 */         if (indata[0] == 29)
/*  416:     */         {
/*  417: 444 */           byte a = 0;
/*  418: 445 */           for (int j = 0; j < 31; j++) {
/*  419: 446 */             a = (byte)(a + indata[j]);
/*  420:     */           }
/*  421: 449 */           indata[31];
/*  422:     */         }
/*  423: 452 */         else if (indata[0] == 36)
/*  424:     */         {
/*  425: 453 */           byte a = 0;
/*  426: 454 */           for (int j = 0; j < 38; j++) {
/*  427: 455 */             a = (byte)(a + indata[j]);
/*  428:     */           }
/*  429: 458 */           indata[38];
/*  430:     */         }
/*  431: 464 */         byte[] transferMw = new byte[34];
/*  432: 467 */         if (indata[0] == 29) {
/*  433: 468 */           for (int j = 0; j < 27; j++) {
/*  434: 469 */             transferMw[j] = indata[(j + 4)];
/*  435:     */           }
/*  436: 473 */         } else if (indata[0] == 36) {
/*  437: 474 */           for (int j = 0; j < 34; j++) {
/*  438: 475 */             transferMw[j] = indata[(j + 4)];
/*  439:     */           }
/*  440:     */         }
/*  441: 483 */         byte[] dataout = new byte[256];
/*  442: 487 */         if (fpmw.length() <= 84) {
/*  443: 488 */           dataout = tPort.VJMJRZDATAOUT(fpmw, 1, transferMw, dataout);
/*  444: 490 */         } else if (hzfw) {
/*  445: 491 */           dataout = tPort.VJMJRZDATAOUT(fpmw, 3, transferMw, dataout);
/*  446:     */         } else {
/*  447: 493 */           dataout = tPort.VJMJRZDATAOUT(fpmw, 2, transferMw, dataout);
/*  448:     */         }
/*  449: 497 */         String tmp = new String(dataout);
/*  450: 498 */         lineunit = new StringTokenizer(tmp);
/*  451:     */       }
/*  452:     */       else
/*  453:     */       {
/*  454: 501 */         this.curJmData.setErrNo(-1); return;
/*  455:     */       }
/*  456:     */       String tmp;
/*  457:     */       int i;
/*  458: 505 */       if (hzfw) {
/*  459: 506 */         for (i = 0; i < 11; i++)
/*  460:     */         {
/*  461: 507 */           renVal[i] = lineunit.nextToken().trim();
/*  462: 508 */           if (i == 0)
/*  463:     */           {
/*  464: 509 */             errno = renVal[0];
/*  465: 510 */             if ((!errno.equals("0")) && (errno.compareTo("1000") < 0)) {
/*  466:     */               break;
/*  467:     */             }
/*  468:     */           }
/*  469:     */         }
/*  470:     */       } else {
/*  471: 516 */         for (i = 0; i < 9; i++)
/*  472:     */         {
/*  473: 517 */           renVal[i] = lineunit.nextToken().trim();
/*  474: 521 */           if (i == 0)
/*  475:     */           {
/*  476: 522 */             errno = renVal[0];
/*  477: 523 */             if ((!errno.equals("0")) && (errno.compareTo("1000") < 0)) {
/*  478:     */               break;
/*  479:     */             }
/*  480:     */           }
/*  481:     */         }
/*  482:     */       }
/*  483: 531 */       if (errno == null)
/*  484:     */       {
/*  485: 532 */         this.curJmData.setErrNo(-1); return;
/*  486:     */       }
/*  487:     */       String tmp;
/*  488:     */       int i;
/*  489: 535 */       if (errno.length() == 0)
/*  490:     */       {
/*  491: 536 */         this.curJmData.setErrNo(-1); return;
/*  492:     */       }
/*  493:     */       String tmp;
/*  494:     */       int i;
/*  495: 540 */       int i_errno = Integer.parseInt(errno);
/*  496: 542 */       if ((i_errno == 0) || (i_errno >= 1000))
/*  497:     */       {
/*  498: 543 */         this.curJmData.setErrNo(i_errno);
/*  499: 544 */         this.curJmData.setFp_dm(renVal[1]);
/*  500: 545 */         this.curJmData.setFp_hm(renVal[2]);
/*  501: 546 */         this.curJmData.setGf_nsrsbh(renVal[4]);
/*  502: 547 */         this.curJmData.setXf_nsrsbh(renVal[5]);
/*  503: 548 */         this.curJmData.setFp_je(Double.parseDouble(renVal[6]));
/*  504: 549 */         this.curJmData.setFp_se(Double.parseDouble(renVal[7]));
/*  505: 550 */         this.curJmData.setKprq(renVal[3]);
/*  506: 551 */         if (renVal[8].indexOf("%") >= 0) {
/*  507: 552 */           renVal[8] = renVal[8].substring(0, renVal[8].length() - 1);
/*  508:     */         }
/*  509: 554 */         this.curJmData.setFp_sl(renVal[8]);
/*  510: 556 */         if (hzfw)
/*  511:     */         {
/*  512: 564 */           chineseAnswer = fpmwExt;
/*  513:     */           
/*  514:     */ 
/*  515:     */ 
/*  516: 568 */           byte[] key = CommonBean.hex2byte(renVal[9]);
/*  517: 569 */           byte[] data = CommonBean.hex2byte(chineseAnswer.substring(0, 672));
/*  518:     */           
/*  519:     */ 
/*  520:     */ 
/*  521:     */ 
/*  522: 574 */           IDEA4Java idea = new IDEA4Java();
/*  523:     */           
/*  524:     */ 
/*  525: 577 */           byte[] chinese1 = idea.IdeaEncrypt(key, data, false);
/*  526: 578 */           chinese1 = reverseByte(chinese1);
/*  527: 579 */           byte[] chinese = new byte[336];
/*  528: 580 */           System.arraycopy(chinese1, 0, chinese, 0, 336);
/*  529:     */           
/*  530:     */ 
/*  531:     */ 
/*  532: 584 */           byte[] crc_s1 = CommonBean.hex2byte(renVal[10].substring(0, 48));
/*  533: 585 */           MessageDigest md5 = MessageDigest.getInstance("MD5");
/*  534: 586 */           md5.update(chinese);
/*  535: 587 */           byte[] crc_s2 = md5.digest();
/*  536: 588 */           byte[] crc_source = new byte[crc_s1.length + crc_s2.length];
/*  537: 589 */           System.arraycopy(crc_s1, 0, crc_source, 0, crc_s1.length);
/*  538: 590 */           System.arraycopy(crc_s2, 0, crc_source, crc_s1.length, 
/*  539: 591 */             crc_s2.length);
/*  540: 592 */           md5.update(crc_source);
/*  541: 593 */           byte[] crc = md5.digest();
/*  542: 594 */           byte[] crc_target = CommonBean.hex2byte(renVal[10]
/*  543: 595 */             .substring(48));
/*  544:     */           
/*  545:     */ 
/*  546:     */ 
/*  547: 599 */           byte[] c = a2bcd(fpmw); byte[] 
/*  548: 600 */             tmp1520_1516 = c;tmp1520_1516[52] = ((byte)(tmp1520_1516[52] ^ c[23]));
/*  549: 601 */           c[52] = ((byte)(c[52] & 0x7F));
/*  550: 602 */           if (c[52] == 66)
/*  551:     */           {
/*  552: 605 */             if ((crc[0] == crc_target[0]) && (crc[1] == crc_target[1]))
/*  553:     */             {
/*  554: 611 */               byte flag = chinese[2];
/*  555: 612 */               if (WlrzConst.isDebug())
/*  556:     */               {
/*  557: 613 */                 System.out.println("折行标志：Flag = " + flag);
/*  558: 614 */                 System.out.println("解密信息：" + new String(chinese));
/*  559:     */               }
/*  560: 616 */               if (flag > 0)
/*  561:     */               {
/*  562: 617 */                 wpmxLst = getHzInfoList(chinese);
/*  563:     */               }
/*  564:     */               else
/*  565:     */               {
/*  566: 620 */                 if (WlrzConst.isDebug()) {
/*  567: 621 */                   System.out.println("---进行折行操作处理---");
/*  568:     */                 }
/*  569: 622 */                 int fl = flag < 0 ? flag + 256 : flag;
/*  570: 623 */                 String flagByte = Integer.toBinaryString(fl);
/*  571: 624 */                 if (WlrzConst.isDebug()) {
/*  572: 625 */                   System.out.println("折行标志字节大小：flagByte = " + flagByte);
/*  573:     */                 }
/*  574: 627 */                 String s2 = flagByte.substring(4);
/*  575: 628 */                 int hs = Integer.parseInt(s2, 2);
/*  576: 629 */                 if (WlrzConst.isDebug()) {
/*  577: 630 */                   System.out.println("折行的行数为：  " + hs);
/*  578:     */                 }
/*  579: 631 */                 String fz = Integer.toBinaryString(chinese[3]);
/*  580: 632 */                 if (WlrzConst.isDebug()) {
/*  581: 633 */                   System.out.println("折行清单明细分组情况字符fz：" + fz);
/*  582:     */                 }
/*  583: 634 */                 int wzh = Integer.parseInt(fz, 10);
/*  584: 635 */                 if (WlrzConst.isDebug()) {
/*  585: 636 */                   System.out.println("未折行标志：wzh = " + wzh);
/*  586:     */                 }
/*  587: 637 */                 if (wzh != 0)
/*  588:     */                 {
/*  589: 638 */                   this.curJmData.setIs_Zh("Y");
/*  590:     */                   
/*  591:     */ 
/*  592:     */ 
/*  593:     */ 
/*  594:     */ 
/*  595:     */ 
/*  596:     */ 
/*  597:     */ 
/*  598:     */ 
/*  599:     */ 
/*  600:     */ 
/*  601:     */ 
/*  602:     */ 
/*  603:     */ 
/*  604:     */ 
/*  605:     */ 
/*  606:     */ 
/*  607:     */ 
/*  608: 657 */                   int len = fz.length();
/*  609: 658 */                   for (int count = 0; count < 7 - len; count++) {
/*  610: 659 */                     fz = "0" + fz;
/*  611:     */                   }
/*  612: 665 */                   fz = fz.substring(0, fz.lastIndexOf("1") + 1);
/*  613: 670 */                   if (fz.startsWith("01")) {
/*  614: 671 */                     fz = fz.substring(1, fz.length());
/*  615:     */                   }
/*  616: 677 */                   fz = fz.replaceAll("01", ",1");
/*  617: 678 */                   fz = fz.replaceAll("0", ",0");
/*  618: 679 */                   if (fz.startsWith(",")) {
/*  619: 680 */                     fz = fz.substring(1, fz.length());
/*  620:     */                   }
/*  621: 686 */                   fz = fz.replaceAll("0", "");
/*  622: 687 */                   String[] mxArray = fz.split(",");
/*  623: 688 */                   int count_hs = 0;
/*  624: 689 */                   for (int count = 0; count < mxArray.length; count++)
/*  625:     */                   {
/*  626: 691 */                     int geshu = mxArray[count].length() + 1;
/*  627: 692 */                     zhLst.add(new Integer(geshu));
/*  628: 693 */                     count_hs += geshu;
/*  629:     */                   }
/*  630: 695 */                   if (hs - count_hs > 0) {
/*  631: 696 */                     for (int j = 0; j < hs - count_hs; j++) {
/*  632: 697 */                       zhLst.add(new Integer("1"));
/*  633:     */                     }
/*  634:     */                   }
/*  635: 700 */                   this.curJmData.setZhLst(zhLst);
/*  636: 702 */                   if (WlrzConst.isDebug())
/*  637:     */                   {
/*  638: 703 */                     System.out.println("////////////////////////////");
/*  639: 704 */                     for (int zzz = 0; zzz < zhLst.size(); zzz++) {
/*  640: 705 */                       System.out.println(zhLst.get(zzz));
/*  641:     */                     }
/*  642: 707 */                     System.out.println("////////////////////////////");
/*  643:     */                   }
/*  644: 709 */                   wpmxLst = getZhHzInfoList(chinese, hs);
/*  645: 710 */                   if (WlrzConst.isDebug())
/*  646:     */                   {
/*  647: 711 */                     System.out.println("////////////////////////////");
/*  648: 712 */                     for (int zzz = 0; zzz < wpmxLst.size(); zzz++) {
/*  649: 713 */                       System.out.println(wpmxLst.get(zzz));
/*  650:     */                     }
/*  651: 715 */                     System.out.println("////////////////////////////");
/*  652:     */                   }
/*  653:     */                 }
/*  654:     */                 else
/*  655:     */                 {
/*  656: 718 */                   this.curJmData.setIs_Zh("N");
/*  657: 719 */                   wpmxLst = getZhHzInfoList(chinese, hs);
/*  658:     */                 }
/*  659:     */               }
/*  660:     */             }
/*  661:     */           }
/*  662: 725 */           else if ((c[52] == 67) || (c[52] == 65)) {
/*  663: 728 */             if ((crc[0] != crc_target[0]) || (crc[1] != crc_target[1]) || 
/*  664: 729 */               (crc[2] != crc_target[2]) || 
/*  665: 730 */               (crc[3] != crc_target[3]))
/*  666:     */             {
/*  667: 731 */               System.out.println("汉字信息CRC校验错误！");
/*  668:     */             }
/*  669:     */             else
/*  670:     */             {
/*  671: 735 */               byte flag = chinese[2];
/*  672: 736 */               if (WlrzConst.isDebug())
/*  673:     */               {
/*  674: 737 */                 System.out.println("折行标志：Flag = " + flag);
/*  675: 738 */                 System.out.println("解密汉字信息：" + new String(chinese));
/*  676:     */               }
/*  677: 740 */               if (flag > 0)
/*  678:     */               {
/*  679: 741 */                 wpmxLst = getHzInfoList(chinese);
/*  680:     */               }
/*  681:     */               else
/*  682:     */               {
/*  683: 744 */                 if (WlrzConst.isDebug()) {
/*  684: 745 */                   System.out.println("---进行折行操作处理---");
/*  685:     */                 }
/*  686: 746 */                 int fl = flag < 0 ? flag + 256 : flag;
/*  687: 747 */                 String flagByte = Integer.toBinaryString(fl);
/*  688: 748 */                 if (WlrzConst.isDebug()) {
/*  689: 749 */                   System.out.println("折行标志字节大小：flagByte = " + flagByte);
/*  690:     */                 }
/*  691: 751 */                 String s2 = flagByte.substring(4);
/*  692: 752 */                 int hs = Integer.parseInt(s2, 2);
/*  693: 753 */                 if (WlrzConst.isDebug()) {
/*  694: 754 */                   System.out.println("折行的行数为：  " + hs);
/*  695:     */                 }
/*  696: 755 */                 String fz = Integer.toBinaryString(chinese[3]);
/*  697: 756 */                 if (WlrzConst.isDebug()) {
/*  698: 757 */                   System.out.println("折行清单明细分组情况字符fz：" + fz);
/*  699:     */                 }
/*  700: 758 */                 int wzh = Integer.parseInt(fz, 10);
/*  701: 759 */                 if (WlrzConst.isDebug()) {
/*  702: 760 */                   System.out.println("未折行标志：wzh = " + wzh);
/*  703:     */                 }
/*  704: 761 */                 if (wzh != 0)
/*  705:     */                 {
/*  706: 762 */                   this.curJmData.setIs_Zh("Y");
/*  707:     */                   
/*  708:     */ 
/*  709: 765 */                   int len = fz.length();
/*  710: 766 */                   for (int count = 0; count < 7 - len; count++) {
/*  711: 767 */                     fz = "0" + fz;
/*  712:     */                   }
/*  713: 773 */                   fz = fz.substring(0, fz.lastIndexOf("1") + 1);
/*  714: 778 */                   if (fz.startsWith("01")) {
/*  715: 779 */                     fz = fz.substring(1, fz.length());
/*  716:     */                   }
/*  717: 785 */                   fz = fz.replaceAll("01", ",1");
/*  718: 786 */                   fz = fz.replaceAll("0", ",0");
/*  719: 787 */                   if (fz.startsWith(",")) {
/*  720: 788 */                     fz = fz.substring(1, fz.length());
/*  721:     */                   }
/*  722: 794 */                   fz = fz.replaceAll("0", "");
/*  723:     */                   
/*  724: 796 */                   String[] mxArray = fz.split(",");
/*  725: 797 */                   int count_hs = 0;
/*  726: 798 */                   for (int count = 0; count < mxArray.length; count++)
/*  727:     */                   {
/*  728: 800 */                     int geshu = mxArray[count].length() + 1;
/*  729: 801 */                     zhLst.add(new Integer(geshu));
/*  730: 802 */                     count_hs += geshu;
/*  731:     */                   }
/*  732: 804 */                   if (hs - count_hs > 0) {
/*  733: 805 */                     for (int j = 0; j < hs - count_hs; j++) {
/*  734: 806 */                       zhLst.add(new Integer("1"));
/*  735:     */                     }
/*  736:     */                   }
/*  737: 809 */                   this.curJmData.setZhLst(zhLst);
/*  738: 811 */                   if (WlrzConst.isDebug())
/*  739:     */                   {
/*  740: 812 */                     System.out.println("////////////////////////////");
/*  741: 813 */                     for (int zzz = 0; zzz < zhLst.size(); zzz++) {
/*  742: 814 */                       System.out.println(zhLst.get(zzz));
/*  743:     */                     }
/*  744: 816 */                     System.out.println("////////////////////////////");
/*  745:     */                   }
/*  746: 818 */                   wpmxLst = getZhHzInfoList(chinese, hs);
/*  747: 819 */                   if (WlrzConst.isDebug())
/*  748:     */                   {
/*  749: 820 */                     System.out.println("////////////////////////////");
/*  750: 821 */                     for (int zzz = 0; zzz < wpmxLst.size(); zzz++) {
/*  751: 822 */                       System.out.println(wpmxLst.get(zzz));
/*  752:     */                     }
/*  753: 824 */                     System.out.println("////////////////////////////");
/*  754:     */                   }
/*  755:     */                 }
/*  756:     */                 else
/*  757:     */                 {
/*  758: 827 */                   this.curJmData.setIs_Zh("N");
/*  759: 828 */                   wpmxLst = getZhHzInfoList(chinese, hs);
/*  760:     */                 }
/*  761:     */               }
/*  762:     */             }
/*  763:     */           }
/*  764:     */         }
/*  765: 837 */         this.curJmData.setHzInfoList(wpmxLst);
/*  766:     */       }
/*  767: 838 */       else if (i_errno == 400)
/*  768:     */       {
/*  769: 839 */         this.curJmData.setErrNo(i_errno);
/*  770:     */       }
/*  771: 840 */       else if (i_errno == 403)
/*  772:     */       {
/*  773: 841 */         this.curJmData.setErrNo(i_errno);
/*  774:     */       }
/*  775: 842 */       else if ((i_errno >= 1) && (i_errno <= 255) && 
/*  776: 843 */         (i_errno >= 1) && (i_errno <= 255))
/*  777:     */       {
/*  778: 844 */         this.curJmData.setErrNo(i_errno);
/*  779:     */       }
/*  780:     */     }
/*  781:     */     catch (MalformedURLException e)
/*  782:     */     {
/*  783: 847 */       this.status = 540;
/*  784: 848 */       System.out.println(e.getMessage());
/*  785:     */     }
/*  786:     */     catch (IOException e)
/*  787:     */     {
/*  788: 850 */       this.status = 550;
/*  789: 851 */       System.out.println(e.getMessage());
/*  790:     */     }
/*  791:     */     catch (NoSuchAlgorithmException e)
/*  792:     */     {
/*  793: 853 */       e.printStackTrace();
/*  794:     */     }
/*  795:     */     catch (Exception e)
/*  796:     */     {
/*  797: 855 */       e.printStackTrace();
/*  798:     */     }
/*  799:     */     finally
/*  800:     */     {
/*  801:     */       try
/*  802:     */       {
/*  803: 858 */         if (socket != null) {
/*  804: 859 */           socket.close();
/*  805:     */         }
/*  806: 860 */         in.close();
/*  807: 861 */         in = null;
/*  808:     */       }
/*  809:     */       catch (Exception localException8) {}
/*  810: 865 */       ulms = System.currentTimeMillis() - ulms;
/*  811: 866 */       System.out.println("[INFO] 解密完成: " + jmip + " (" + ulms + "ms)");
/*  812:     */     }
/*  813:     */   }
/*  814:     */   
/*  815:     */   public void doJmProc(String nsrsbh, String fpmw, String fpid, String jmip, boolean hzfw)
/*  816:     */   {
/*  817: 870 */     List zhLst = new ArrayList();
/*  818:     */     
/*  819:     */ 
/*  820:     */ 
/*  821: 874 */     BufferedReader in = null;
/*  822: 875 */     String[] renVal = { "", "", "", "", "", "", "", "", "", "", "" };
/*  823: 876 */     long ulms = System.currentTimeMillis();
/*  824:     */     
/*  825: 878 */     String qd_bz = hzfw ? "Y" : "N";String chineseAnswer = "";
/*  826: 879 */     List wpmxLst = new ArrayList();
/*  827:     */     
/*  828: 881 */     System.out.println("[INFO] JmjIp :" + jmip);
/*  829: 883 */     if (jmip == null)
/*  830:     */     {
/*  831: 884 */       this.status = 530;
/*  832: 885 */       System.out.println("[WARN] 没有可用的解密工作站 !");
/*  833: 886 */       return;
/*  834:     */     }
/*  835: 890 */     System.setProperty("sun.net.client.defaultConnectTimeout", "6000");
/*  836: 891 */     System.setProperty("sun.net.client.defaultReadTimeout", "6000");
/*  837: 892 */     if (hzfw)
/*  838:     */     {
/*  839: 893 */       chineseAnswer = fpmw.substring(108);
/*  840: 894 */       fpmw = fpmw.substring(0, 108);
/*  841:     */     }
/*  842: 896 */     String home = "http://" + jmip + ":1299/getfpage?user=" + nsrsbh + "&sycode=" + 
/*  843: 897 */       fpid + "&miwen=" + fpmw + "&FMT=0&MWTYE=" + (
/*  844: 898 */       hzfw ? "3" : fpmw.length() == 84 ? "1" : "2");
/*  845: 900 */     if (WlrzConst.isDebug()) {
/*  846: 901 */       System.out.println("[home] " + home);
/*  847:     */     }
/*  848: 903 */     if (WlrzConst.isDebug()) {
/*  849: 904 */       System.out.println("[fpmw] " + fpmw);
/*  850:     */     }
/*  851: 906 */     String errno = null;
/*  852:     */     try
/*  853:     */     {
/*  854: 909 */       if (!fpCheck(fpmw))
/*  855:     */       {
/*  856: 910 */         this.curJmData.setErrNo(-1);
/*  857: 911 */         return;
/*  858:     */       }
/*  859: 914 */       URL url = new URL(home);
/*  860:     */       
/*  861: 916 */       URLConnection connection = url.openConnection();
/*  862: 917 */       in = new BufferedReader(new InputStreamReader(connection
/*  863: 918 */         .getInputStream()));
/*  864:     */       
/*  865: 920 */       int i = 0;
/*  866:     */       String tmp;
/*  867: 922 */       while ((tmp = in.readLine()) != null)
/*  868:     */       {
/*  869:     */         String tmp;
/*  870: 923 */         renVal[i] = tmp;
/*  871:     */         
/*  872: 925 */         errno = renVal[0];
/*  873: 928 */         if ((!errno.equals("0")) && (!errno.equals("1001")) && 
/*  874: 929 */           (!errno.equals("1002"))) {
/*  875:     */           break;
/*  876:     */         }
/*  877: 930 */         i++;
/*  878:     */       }
/*  879: 934 */       in.close();
/*  880: 936 */       if (errno == null)
/*  881:     */       {
/*  882: 937 */         this.curJmData.setErrNo(-1); return;
/*  883:     */       }
/*  884:     */       String tmp;
/*  885:     */       int i;
/*  886:     */       URLConnection connection;
/*  887:     */       URL url;
/*  888: 940 */       if (errno.length() == 0)
/*  889:     */       {
/*  890: 941 */         this.curJmData.setErrNo(-1); return;
/*  891:     */       }
/*  892:     */       String tmp;
/*  893:     */       int i;
/*  894:     */       URLConnection connection;
/*  895:     */       URL url;
/*  896: 945 */       int i_errno = Integer.parseInt(errno);
/*  897: 947 */       switch (i_errno)
/*  898:     */       {
/*  899:     */       case 0: 
/*  900:     */       case 1001: 
/*  901:     */       case 1002: 
/*  902: 951 */         this.curJmData.setErrNo(i_errno);
/*  903:     */         
/*  904: 953 */         this.curJmData.setFp_dm(renVal[1]);
/*  905:     */         
/*  906: 955 */         this.curJmData.setFp_hm(renVal[2]);
/*  907:     */         
/*  908: 957 */         this.curJmData.setGf_nsrsbh(renVal[4]);
/*  909:     */         
/*  910: 959 */         this.curJmData.setXf_nsrsbh(renVal[5]);
/*  911:     */         
/*  912: 961 */         this.curJmData.setFp_je(Double.parseDouble(renVal[6]));
/*  913:     */         
/*  914: 963 */         this.curJmData.setFp_se(Double.parseDouble(renVal[7]));
/*  915:     */         
/*  916: 965 */         this.curJmData.setKprq(renVal[3]);
/*  917: 966 */         if (renVal[8].indexOf("%") >= 0) {
/*  918: 967 */           renVal[8] = renVal[8].substring(0, renVal[8].length() - 1);
/*  919:     */         }
/*  920: 969 */         this.curJmData.setFp_sl(renVal[8]);
/*  921: 970 */         if (hzfw)
/*  922:     */         {
/*  923: 977 */           byte[] key = CommonBean.hex2byte(renVal[9]);
/*  924: 978 */           byte[] data = CommonBean.hex2byte(chineseAnswer.substring(0, 672));
/*  925: 979 */           if (WlrzConst.isDebug()) {
/*  926: 980 */             System.out.println("开始汉字解密");
/*  927:     */           }
/*  928: 982 */           byte[] chinese1 = new IDEA4Java().IdeaEncrypt(key, data, false);
/*  929: 983 */           chinese1 = reverseByte(chinese1);
/*  930: 984 */           byte[] chinese = new byte[336];
/*  931: 985 */           System.arraycopy(chinese1, 0, chinese, 0, 336);
/*  932: 986 */           if (WlrzConst.isDebug()) {
/*  933: 987 */             System.out.println("汉字解密成功");
/*  934:     */           }
/*  935: 988 */           byte[] crc_s1 = CommonBean.hex2byte(renVal[10].substring(0, 48));
/*  936: 989 */           MessageDigest md5 = MessageDigest.getInstance("MD5");
/*  937: 990 */           md5.update(chinese);
/*  938: 991 */           byte[] crc_s2 = md5.digest();
/*  939: 992 */           byte[] crc_source = new byte[crc_s1.length + crc_s2.length];
/*  940: 993 */           System.arraycopy(crc_s1, 0, crc_source, 0, crc_s1.length);
/*  941: 994 */           System.arraycopy(crc_s2, 0, crc_source, crc_s1.length, crc_s2.length);
/*  942: 995 */           md5.update(crc_source);
/*  943: 996 */           byte[] crc = md5.digest();
/*  944: 997 */           byte[] crc_target = CommonBean.hex2byte(renVal[10].substring(48));
/*  945:     */           
/*  946: 999 */           byte[] c = a2bcd(fpmw); byte[] 
/*  947:1000 */             tmp1063_1059 = c;tmp1063_1059[52] = ((byte)(tmp1063_1059[52] ^ c[23]));
/*  948:1001 */           c[52] = ((byte)(c[52] & 0x7F));
/*  949:1002 */           if (c[52] == 66)
/*  950:     */           {
/*  951:1004 */             if ((crc[0] != crc_target[0]) || (crc[1] != crc_target[1]))
/*  952:     */             {
/*  953:1006 */               System.out.println("##########HX2/KT2 CRC校验信息开始#############");
/*  954:1007 */               System.out.println("key = " + renVal[9]);
/*  955:1008 */               System.out.println("data = " + chineseAnswer.substring(0, 672));
/*  956:1009 */               System.out.println("##########Hx2/KT2 CRC校验信息结束#############");
/*  957:     */             }
/*  958:     */             else
/*  959:     */             {
/*  960:1012 */               byte flag = chinese[2];
/*  961:1013 */               if (WlrzConst.isDebug())
/*  962:     */               {
/*  963:1014 */                 System.out.println("折行标志：Flag = " + flag);
/*  964:1015 */                 System.out.println("解密汉字信息：" + new String(chinese));
/*  965:     */               }
/*  966:1017 */               if (flag > 0)
/*  967:     */               {
/*  968:1018 */                 wpmxLst = getHzInfoList(chinese);
/*  969:     */               }
/*  970:     */               else
/*  971:     */               {
/*  972:1021 */                 if (WlrzConst.isDebug()) {
/*  973:1022 */                   System.out.println("---进行折行操作处理---");
/*  974:     */                 }
/*  975:1023 */                 int fl = flag < 0 ? flag + 256 : flag;
/*  976:1024 */                 String flagByte = Integer.toBinaryString(fl);
/*  977:1025 */                 if (WlrzConst.isDebug()) {
/*  978:1026 */                   System.out.println("折行标志字节大小：flagByte = " + flagByte);
/*  979:     */                 }
/*  980:1028 */                 String s2 = flagByte.substring(4);
/*  981:1029 */                 int hs = Integer.parseInt(s2, 2);
/*  982:1030 */                 if (WlrzConst.isDebug()) {
/*  983:1031 */                   System.out.println("折行的行数为：  " + hs);
/*  984:     */                 }
/*  985:1032 */                 String fz = Integer.toBinaryString(chinese[3]);
/*  986:1033 */                 if (WlrzConst.isDebug()) {
/*  987:1034 */                   System.out.println("折行清单明细分组情况字符fz：" + fz);
/*  988:     */                 }
/*  989:1035 */                 int wzh = Integer.parseInt(fz, 10);
/*  990:1036 */                 if (WlrzConst.isDebug()) {
/*  991:1037 */                   System.out.println("未折行标志：wzh = " + wzh);
/*  992:     */                 }
/*  993:1038 */                 if (wzh != 0)
/*  994:     */                 {
/*  995:1039 */                   this.curJmData.setIs_Zh("Y");
/*  996:     */                   
/*  997:1041 */                   int len = fz.length();
/*  998:1042 */                   for (int count = 0; count < 7 - len; count++) {
/*  999:1043 */                     fz = "0" + fz;
/* 1000:     */                   }
/* 1001:1049 */                   fz = fz.substring(0, fz.lastIndexOf("1") + 1);
/* 1002:1054 */                   if (fz.startsWith("01")) {
/* 1003:1055 */                     fz = fz.substring(1, fz.length());
/* 1004:     */                   }
/* 1005:1061 */                   fz = fz.replaceAll("01", ",1");
/* 1006:1062 */                   fz = fz.replaceAll("0", ",0");
/* 1007:1063 */                   if (fz.startsWith(",")) {
/* 1008:1064 */                     fz = fz.substring(1, fz.length());
/* 1009:     */                   }
/* 1010:1070 */                   fz = fz.replaceAll("0", "");
/* 1011:     */                   
/* 1012:1072 */                   String[] mxArray = fz.split(",");
/* 1013:1073 */                   int count_hs = 0;
/* 1014:1074 */                   for (int count = 0; count < mxArray.length; count++)
/* 1015:     */                   {
/* 1016:1076 */                     int geshu = mxArray[count].length() + 1;
/* 1017:1077 */                     zhLst.add(new Integer(geshu));
/* 1018:1078 */                     count_hs += geshu;
/* 1019:     */                   }
/* 1020:1080 */                   if (hs - count_hs > 0) {
/* 1021:1081 */                     for (int j = 0; j < hs - count_hs; j++) {
/* 1022:1082 */                       zhLst.add(new Integer("1"));
/* 1023:     */                     }
/* 1024:     */                   }
/* 1025:1085 */                   this.curJmData.setZhLst(zhLst);
/* 1026:1087 */                   if (WlrzConst.isDebug())
/* 1027:     */                   {
/* 1028:1088 */                     System.out.println("////////////////////////////");
/* 1029:1089 */                     for (int zzz = 0; zzz < zhLst.size(); zzz++) {
/* 1030:1090 */                       System.out.println(zhLst.get(zzz));
/* 1031:     */                     }
/* 1032:1092 */                     System.out.println("////////////////////////////");
/* 1033:     */                   }
/* 1034:1094 */                   wpmxLst = getZhHzInfoList(chinese, hs);
/* 1035:1095 */                   if (WlrzConst.isDebug())
/* 1036:     */                   {
/* 1037:1096 */                     System.out.println("////////////////////////////");
/* 1038:1097 */                     for (int zzz = 0; zzz < wpmxLst.size(); zzz++) {
/* 1039:1098 */                       System.out.println(wpmxLst.get(zzz));
/* 1040:     */                     }
/* 1041:1100 */                     System.out.println("////////////////////////////");
/* 1042:     */                   }
/* 1043:     */                 }
/* 1044:     */                 else
/* 1045:     */                 {
/* 1046:1103 */                   this.curJmData.setIs_Zh("N");
/* 1047:1104 */                   wpmxLst = getZhHzInfoList(chinese, hs);
/* 1048:     */                 }
/* 1049:     */               }
/* 1050:     */             }
/* 1051:     */           }
/* 1052:1108 */           else if ((c[52] == 67) || (c[52] == 65)) {
/* 1053:1110 */             if ((crc[0] != crc_target[0]) || (crc[1] != crc_target[1]) || 
/* 1054:1111 */               (crc[2] != crc_target[2]) || 
/* 1055:1112 */               (crc[3] != crc_target[3]))
/* 1056:     */             {
/* 1057:1114 */               System.out.println("##########AI3 CRC校验信息开始#############");
/* 1058:1115 */               System.out.println("key = " + renVal[9]);
/* 1059:1116 */               System.out.println("data = " + 
/* 1060:1117 */                 chineseAnswer.substring(0, 672));
/* 1061:1118 */               System.out
/* 1062:1119 */                 .println("##########AI3 CRC校验信息结束#############");
/* 1063:     */             }
/* 1064:     */             else
/* 1065:     */             {
/* 1066:1122 */               byte flag = chinese[2];
/* 1067:1123 */               if (WlrzConst.isDebug())
/* 1068:     */               {
/* 1069:1124 */                 System.out.println("折行标志：Flag = " + flag);
/* 1070:1125 */                 System.out.println("解密汉字信息：" + new String(chinese));
/* 1071:     */               }
/* 1072:1127 */               if (flag > 0)
/* 1073:     */               {
/* 1074:1128 */                 wpmxLst = getHzInfoList(chinese);
/* 1075:     */               }
/* 1076:     */               else
/* 1077:     */               {
/* 1078:1131 */                 if (WlrzConst.isDebug()) {
/* 1079:1132 */                   System.out.println("---进行折行操作处理---");
/* 1080:     */                 }
/* 1081:1133 */                 int fl = flag < 0 ? flag + 256 : flag;
/* 1082:1134 */                 String flagByte = Integer.toBinaryString(fl);
/* 1083:1135 */                 if (WlrzConst.isDebug()) {
/* 1084:1136 */                   System.out.println("折行标志字节大小：flagByte = " + flagByte);
/* 1085:     */                 }
/* 1086:1138 */                 String s2 = flagByte.substring(4);
/* 1087:1139 */                 int hs = Integer.parseInt(s2, 2);
/* 1088:1140 */                 if (WlrzConst.isDebug()) {
/* 1089:1141 */                   System.out.println("折行的行数为：  " + hs);
/* 1090:     */                 }
/* 1091:1142 */                 String fz = Integer.toBinaryString(chinese[3]);
/* 1092:1143 */                 if (WlrzConst.isDebug()) {
/* 1093:1144 */                   System.out.println("折行清单明细分组情况字符fz：" + fz);
/* 1094:     */                 }
/* 1095:1145 */                 int wzh = Integer.parseInt(fz, 10);
/* 1096:1146 */                 if (WlrzConst.isDebug()) {
/* 1097:1147 */                   System.out.println("未折行标志：wzh = " + wzh);
/* 1098:     */                 }
/* 1099:1148 */                 if (wzh != 0)
/* 1100:     */                 {
/* 1101:1149 */                   this.curJmData.setIs_Zh("Y");
/* 1102:     */                   
/* 1103:     */ 
/* 1104:     */ 
/* 1105:     */ 
/* 1106:     */ 
/* 1107:     */ 
/* 1108:     */ 
/* 1109:     */ 
/* 1110:     */ 
/* 1111:     */ 
/* 1112:     */ 
/* 1113:     */ 
/* 1114:     */ 
/* 1115:     */ 
/* 1116:     */ 
/* 1117:     */ 
/* 1118:     */ 
/* 1119:     */ 
/* 1120:1168 */                   int len = fz.length();
/* 1121:1169 */                   for (int count = 0; count < 7 - len; count++) {
/* 1122:1170 */                     fz = "0" + fz;
/* 1123:     */                   }
/* 1124:1175 */                   fz = fz.substring(0, fz.lastIndexOf("1") + 1);
/* 1125:1180 */                   if (fz.startsWith("01")) {
/* 1126:1181 */                     fz = fz.substring(1, fz.length());
/* 1127:     */                   }
/* 1128:1187 */                   fz = fz.replaceAll("01", ",1");
/* 1129:1188 */                   fz = fz.replaceAll("0", ",0");
/* 1130:1189 */                   if (fz.startsWith(",")) {
/* 1131:1190 */                     fz = fz.substring(1, fz.length());
/* 1132:     */                   }
/* 1133:1196 */                   fz = fz.replaceAll("0", "");
/* 1134:     */                   
/* 1135:1198 */                   String[] mxArray = fz.split(",");
/* 1136:1199 */                   int count_hs = 0;
/* 1137:1200 */                   for (int count = 0; count < mxArray.length; count++)
/* 1138:     */                   {
/* 1139:1202 */                     int geshu = mxArray[count].length() + 1;
/* 1140:1203 */                     zhLst.add(new Integer(geshu));
/* 1141:1204 */                     count_hs += geshu;
/* 1142:     */                   }
/* 1143:1207 */                   if (hs - count_hs > 0) {
/* 1144:1208 */                     for (int j = 0; j < hs - count_hs; j++) {
/* 1145:1209 */                       zhLst.add(new Integer("1"));
/* 1146:     */                     }
/* 1147:     */                   }
/* 1148:1212 */                   this.curJmData.setZhLst(zhLst);
/* 1149:1215 */                   if (WlrzConst.isDebug())
/* 1150:     */                   {
/* 1151:1216 */                     System.out.println("////////////////////////////");
/* 1152:1217 */                     for (int zzz = 0; zzz < zhLst.size(); zzz++) {
/* 1153:1218 */                       System.out.println(zhLst.get(zzz));
/* 1154:     */                     }
/* 1155:1220 */                     System.out.println("////////////////////////////");
/* 1156:     */                   }
/* 1157:1222 */                   wpmxLst = getZhHzInfoList(chinese, hs);
/* 1158:1223 */                   if (WlrzConst.isDebug())
/* 1159:     */                   {
/* 1160:1224 */                     System.out.println("////////////////////////////");
/* 1161:1225 */                     for (int zzz = 0; zzz < wpmxLst.size(); zzz++) {
/* 1162:1226 */                       System.out.println(wpmxLst.get(zzz));
/* 1163:     */                     }
/* 1164:1228 */                     System.out.println("////////////////////////////");
/* 1165:     */                   }
/* 1166:     */                 }
/* 1167:     */                 else
/* 1168:     */                 {
/* 1169:1231 */                   this.curJmData.setIs_Zh("N");
/* 1170:1232 */                   wpmxLst = getZhHzInfoList(chinese, hs);
/* 1171:     */                 }
/* 1172:     */               }
/* 1173:     */             }
/* 1174:     */           }
/* 1175:     */         }
/* 1176:1238 */         this.curJmData.setHzInfoList(wpmxLst);
/* 1177:1239 */         this.curJmData.setQd_bz(qd_bz);
/* 1178:1240 */         break;
/* 1179:     */       case 400: 
/* 1180:1243 */         this.curJmData.setErrNo(i_errno);
/* 1181:1244 */         break;
/* 1182:     */       case 403: 
/* 1183:1247 */         this.curJmData.setErrNo(i_errno);
/* 1184:1248 */         break;
/* 1185:     */       default: 
/* 1186:1251 */         if ((i_errno >= 1) && (i_errno <= 255)) {
/* 1187:1252 */           this.curJmData.setErrNo(i_errno);
/* 1188:     */         }
/* 1189:     */         break;
/* 1190:     */       }
/* 1191:     */     }
/* 1192:     */     catch (MalformedURLException e)
/* 1193:     */     {
/* 1194:1255 */       this.status = 540;
/* 1195:1256 */       System.out.println(e.getMessage());
/* 1196:     */     }
/* 1197:     */     catch (ConnectException e)
/* 1198:     */     {
/* 1199:1258 */       this.status = 540;
/* 1200:1259 */       System.out.println("[info] 解密机连接超时 " + e.getMessage());
/* 1201:     */     }
/* 1202:     */     catch (IOException e)
/* 1203:     */     {
/* 1204:1261 */       this.status = 550;
/* 1205:1262 */       System.out.println(e.getMessage());
/* 1206:     */     }
/* 1207:     */     catch (NoSuchAlgorithmException e)
/* 1208:     */     {
/* 1209:1265 */       e.printStackTrace();
/* 1210:     */     }
/* 1211:     */     catch (Exception e)
/* 1212:     */     {
/* 1213:1268 */       e.printStackTrace();
/* 1214:     */     }
/* 1215:     */     finally
/* 1216:     */     {
/* 1217:1270 */       ulms = System.currentTimeMillis() - ulms;
/* 1218:1271 */       System.out.println("[INFO] 解密完成: " + jmip + " (" + ulms + "ms)");
/* 1219:     */     }
/* 1220:     */   }
/* 1221:     */   
/* 1222:     */   public JmFpDataBean getCurJmData()
/* 1223:     */   {
/* 1224:1284 */     return this.curJmData;
/* 1225:     */   }
/* 1226:     */   
/* 1227:     */   public int getStatus()
/* 1228:     */   {
/* 1229:1293 */     return this.status;
/* 1230:     */   }
/* 1231:     */   
/* 1232:     */   public void setCurJmData(JmFpDataBean newCurJmData)
/* 1233:     */   {
/* 1234:1303 */     this.curJmData = newCurJmData;
/* 1235:     */   }
/* 1236:     */   
/* 1237:     */   public void setStatus(int newStatus)
/* 1238:     */   {
/* 1239:1313 */     this.status = newStatus;
/* 1240:     */   }
/* 1241:     */   
/* 1242:     */   private List getHzInfoList(byte[] data)
/* 1243:     */   {
/* 1244:1323 */     if (data.length < 6) {
/* 1245:1324 */       return null;
/* 1246:     */     }
/* 1247:1327 */     int chineseStartPos = 3 + data[2] * 3;
/* 1248:1328 */     int[] len = new int[chineseStartPos];
/* 1249:1329 */     for (int i = 0; i < chineseStartPos; i++) {
/* 1250:1330 */       len[i] = data[i];
/* 1251:     */     }
/* 1252:1332 */     List rtn = new ArrayList(chineseStartPos);
/* 1253:1333 */     int offset = chineseStartPos;
/* 1254:1334 */     rtn.add(replaceInvlidCharacter(new String(data, offset, len[0])));
/* 1255:1335 */     offset += len[0];
/* 1256:1336 */     rtn.add(replaceInvlidCharacter(new String(data, offset, len[1])));
/* 1257:1337 */     offset += len[1];
/* 1258:1338 */     rtn.add(String.valueOf(len[2]));
/* 1259:1340 */     for (int k = 3; k < chineseStartPos; k++) {
/* 1260:1341 */       if (len[k] > 0)
/* 1261:     */       {
/* 1262:1342 */         rtn.add(replaceInvlidCharacter(new String(data, offset, len[k])));
/* 1263:1343 */         offset += len[k];
/* 1264:     */       }
/* 1265:     */       else
/* 1266:     */       {
/* 1267:1345 */         rtn.add("");
/* 1268:     */       }
/* 1269:     */     }
/* 1270:1348 */     return rtn;
/* 1271:     */   }
/* 1272:     */   
/* 1273:     */   private byte[] reverseByte(byte[] input)
/* 1274:     */   {
/* 1275:1352 */     for (int i = 0; i < input.length; i++) {
/* 1276:1353 */       if (i % 2 == 0)
/* 1277:     */       {
/* 1278:1354 */         byte temp = input[i];
/* 1279:1355 */         input[i] = input[(i + 1)];
/* 1280:1356 */         input[(i + 1)] = temp;
/* 1281:     */       }
/* 1282:     */     }
/* 1283:1360 */     return input;
/* 1284:     */   }
/* 1285:     */   
/* 1286:     */   public boolean fpCheck(String fpmw)
/* 1287:     */   {
/* 1288:1369 */     boolean checkResult = false;
/* 1289:1370 */     if (fpmw.length() == 84) {
/* 1290:1371 */       checkResult = fpCheckSum(fpmw);
/* 1291:1372 */     } else if (fpmw.length() == 108) {
/* 1292:1373 */       checkResult = fpCheckSum108(fpmw);
/* 1293:     */     } else {
/* 1294:1375 */       checkResult = false;
/* 1295:     */     }
/* 1296:1377 */     return checkResult;
/* 1297:     */   }
/* 1298:     */   
/* 1299:     */   public boolean fpCheckSum(String fpmw)
/* 1300:     */   {
/* 1301:1385 */     int wCheckSum = 0;int wCorrect = 0;
/* 1302:1387 */     for (int i = 0; i < 84; i++)
/* 1303:     */     {
/* 1304:1389 */       char s = fpmw.charAt(i);
/* 1305:1390 */       int wValue = GetByteValue(s);
/* 1306:1392 */       if (wValue == -1) {
/* 1307:1392 */         return false;
/* 1308:     */       }
/* 1309:1393 */       if (i % 2 == 0) {
/* 1310:1393 */         wValue <<= 4;
/* 1311:     */       }
/* 1312:1394 */       if (i < 82) {
/* 1313:1394 */         wCheckSum += wValue;
/* 1314:     */       } else {
/* 1315:1395 */         wCorrect += wValue;
/* 1316:     */       }
/* 1317:     */     }
/* 1318:1397 */     wCheckSum &= 0xFF;
/* 1319:1398 */     return wCheckSum == wCorrect;
/* 1320:     */   }
/* 1321:     */   
/* 1322:     */   public boolean fpCheckSum108(String fpmw)
/* 1323:     */   {
/* 1324:1407 */     int wCheckSum = 0;int wCorrect = 0;
/* 1325:1409 */     for (int i = 0; i < 108; i++)
/* 1326:     */     {
/* 1327:1411 */       char s = fpmw.charAt(i);
/* 1328:1412 */       int wValue = GetByteValue(s);
/* 1329:1414 */       if (wValue == -1) {
/* 1330:1414 */         return false;
/* 1331:     */       }
/* 1332:1415 */       if (i % 2 == 0) {
/* 1333:1415 */         wValue <<= 4;
/* 1334:     */       }
/* 1335:1416 */       if (i < 106) {
/* 1336:1416 */         wCheckSum += wValue;
/* 1337:     */       } else {
/* 1338:1417 */         wCorrect += wValue;
/* 1339:     */       }
/* 1340:     */     }
/* 1341:1419 */     wCheckSum &= 0xFF;
/* 1342:1420 */     return wCheckSum == wCorrect;
/* 1343:     */   }
/* 1344:     */   
/* 1345:     */   int GetByteValue(char bChar)
/* 1346:     */   {
/* 1347:1429 */     if ((bChar >= '0') && (bChar <= '9')) {
/* 1348:1430 */       return bChar - '0';
/* 1349:     */     }
/* 1350:1432 */     switch (bChar)
/* 1351:     */     {
/* 1352:     */     case '+': 
/* 1353:1434 */       return 10;
/* 1354:     */     case '-': 
/* 1355:1435 */       return 11;
/* 1356:     */     case '*': 
/* 1357:1436 */       return 12;
/* 1358:     */     case '/': 
/* 1359:1437 */       return 13;
/* 1360:     */     case '<': 
/* 1361:1438 */       return 14;
/* 1362:     */     case '>': 
/* 1363:1439 */       return 15;
/* 1364:     */     }
/* 1365:1440 */     return -1;
/* 1366:     */   }
/* 1367:     */   
/* 1368:     */   private String replaceInvlidCharacter(String original)
/* 1369:     */   {
/* 1370:1448 */     String newString = original.replaceAll("\t", "");
/* 1371:1449 */     newString = newString.replaceAll("\t", "");
/* 1372:1450 */     newString = newString.replaceAll(" ", "");
/* 1373:1451 */     newString = newString.replaceAll("　", "");
/* 1374:     */     
/* 1375:1453 */     return newString;
/* 1376:     */   }
/* 1377:     */   
/* 1378:     */   public static void main(String[] args)
/* 1379:     */   {
/* 1380:1457 */     List a = new ArrayList();
/* 1381:1458 */     System.out.println(a.size());
/* 1382:     */   }
/* 1383:     */   
/* 1384:     */   public static byte[] a2bcd(String hex)
/* 1385:     */   {
/* 1386:1462 */     int len = hex.length() / 2;
/* 1387:1463 */     byte[] result = new byte[len];
/* 1388:1464 */     char[] achar = hex.toCharArray();
/* 1389:1465 */     for (int i = 0; i < achar.length; i += 2)
/* 1390:     */     {
/* 1391:1466 */       char a = achar[i];
/* 1392:1467 */       char a_1 = achar[(i + 1)];
/* 1393:1468 */       a = mw2a(a);
/* 1394:1469 */       a_1 = mw2a(a_1);
/* 1395:     */       
/* 1396:1471 */       result[(i / 2)] = ((byte)(toByte(a) << 4 | toByte(a_1)));
/* 1397:     */     }
/* 1398:1473 */     return result;
/* 1399:     */   }
/* 1400:     */   
/* 1401:     */   public static char mw2a(char a)
/* 1402:     */   {
/* 1403:1476 */     if ((a < '0') || (a > '9')) {
/* 1404:1477 */       a = (char)(65 + "+-*/<>".indexOf(a));
/* 1405:     */     }
/* 1406:1479 */     return a;
/* 1407:     */   }
/* 1408:     */   
/* 1409:     */   private static byte toByte(char c)
/* 1410:     */   {
/* 1411:1482 */     byte b = (byte)"0123456789ABCDEF".indexOf(c);
/* 1412:1483 */     return b;
/* 1413:     */   }
/* 1414:     */   
/* 1415:     */   private List getZhHzInfoList(byte[] data, int hs)
/* 1416:     */   {
/* 1417:1496 */     if (data.length < 7) {
/* 1418:1497 */       return null;
/* 1419:     */     }
/* 1420:1502 */     int chineseStartPos = 4 + hs * 3;
/* 1421:     */     
/* 1422:     */ 
/* 1423:1505 */     int[] len = new int[chineseStartPos];
/* 1424:1506 */     for (int i = 0; i < chineseStartPos; i++) {
/* 1425:1507 */       len[i] = data[i];
/* 1426:     */     }
/* 1427:1510 */     List rtn = new ArrayList(chineseStartPos);
/* 1428:1511 */     int offset = chineseStartPos;
/* 1429:1512 */     rtn.add(new String(data, offset, len[0]));
/* 1430:1513 */     offset += len[0];
/* 1431:1514 */     rtn.add(new String(data, offset, len[1]));
/* 1432:1515 */     offset += len[1];
/* 1433:     */     
/* 1434:1517 */     rtn.add(String.valueOf(hs));
/* 1435:1519 */     for (int k = 4; k < chineseStartPos; k++) {
/* 1436:1520 */       if (len[k] > 0)
/* 1437:     */       {
/* 1438:1521 */         rtn.add(new String(data, offset, len[k]));
/* 1439:1522 */         offset += len[k];
/* 1440:     */       }
/* 1441:     */       else
/* 1442:     */       {
/* 1443:1524 */         rtn.add("");
/* 1444:     */       }
/* 1445:     */     }
/* 1446:1528 */     return rtn;
/* 1447:     */   }
/* 1448:     */ }


/* Location:           D:\htjs\document\wsrz\WsrzEjbInf\
 * Qualified Name:     gov.sat.tax.fwsk.wlrz.JmHandler
 * JD-Core Version:    0.7.0.1
 */